package com.lry.web.cartoon.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lry.web.cartoon.entity.CartoonUpdate;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface CartoonUpdateMapper extends BaseMapper<CartoonUpdate> {

    @Update("update cartoon_update set deleted=0 where cartoon_id = #{cartoonId} and deleted=1")
    int updateDeleted(@Param("cartoonId")String cartoonId);

    @Delete("delete from cartoon_update where cartoon_id = #{cartoonId}")
    int deleteByCartoonId(@Param("cartoonId")String cartoonId);

    @Delete("delete from cartoon_update where cartoon_variable_id = #{cVId}")
    int deleteByCVId(@Param("cVId")String cVId);
    @Update("update cartoon_update set deleted=1 where DATE_SUB(CURDATE(), INTERVAL 30 DAY) > date(update_time)")
    void updateTime30T();
}
